/**
 * 
 */
package com.sesame.daoimpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sesame.dao.AskDAO;
import com.sesame.domain.Ask;

/**
 * @author shubeta
 *
 */
public class AskDAOImpl extends SqlMapClientDaoSupport implements AskDAO {

    public void addAsk(Ask ask) {
        getSqlMapClientTemplate().insert("addAsk", ask);
    }

    public void deleteAskById(Integer id) {
        getSqlMapClientTemplate().delete("deleteAskById", id);
    }
    
    public void deleteAskByNickName(String nickName) {
        getSqlMapClientTemplate().delete("deleteAskByNickName", nickName);
    }
    
    @SuppressWarnings("unchecked")
    public List<Ask> getAllAsk() {
        return (List<Ask>) getSqlMapClientTemplate().queryForList("getAllAsk");
    }

    public Ask getAskByNickName(String nickName) {
        return (Ask) getSqlMapClientTemplate().queryForObject("getAskByNickName", nickName);
    }

    public void updateAsk(Ask ask) {
        getSqlMapClientTemplate().update("updateAsk", ask);
    }

}
